/** \file gu_shader.h */

#pragma once

#include "gu_shader_variable.h"
#include "gu_shader_parser.h"

#include <string>
#include <stdint.h>

#include<exception>

namespace gu
{

enum ShaderType{GEOMETRY = 0, FRAGMENT = 1, VERTEX = 2};

/** Wrapper for entire shader program. */
class Shader
{
public:
    typedef std::shared_ptr<Shader> shared_ptr;

    virtual void setSource(ShaderType t, std::string& str) = 0;
    virtual void setSource(ShaderType t, const char* str) = 0;
    virtual const std::string* getSource(ShaderType t) = 0;

    virtual uint32_t getUniformLocation(const char* str) = 0;
    virtual uint32_t getAttribLocation(const char* str) = 0;

    virtual uint32_t program() = 0;

    virtual bool compile() = 0;
    virtual ShaderDialect dialect() = 0;
    virtual VariableMap& variableMap() = 0;

};


Shader* newShader(ShaderDialect dialect);

Shader* newShader(ShaderDialect dialect, const char* vertexShader, const char* fragmentShader);

void    unuseShader();
void    useShader(Shader* shader);

}
